import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import ModuleView from '../views/ModuleView.vue'
import MysqlView from '../views/MysqlView.vue'
import ToolView from '../views/ToolView.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'entity',
      component: HomeView
    },
    {
      path: '/module',
      name: 'module',
      component: ModuleView
    },
    {
      path: '/mysql',
      name: 'mysql',
      component: MysqlView
    },
    {
      path: '/tool',
      name: 'tool',
      component: ToolView
    }
  ]
})

// 添加路由变化监听，更新选中的菜单项
router.afterEach((to) => {
  // 可以在这里处理路由变化后的逻辑
  console.log('Route changed to:', to.name);
});

export default router
